home *** CD-ROM | disk | FTP | other *** search
/ MacWorld UK 2000 March / MW_UK_2000_03.iso / Shareware World / Utilities / Text Processing / Alpha / Help / Matlab Help < prev    next >
Encoding:
Text File  |  1997-11-23  |  11.2 KB  |  319 lines  |  [TEXT/ALFA]

  1. ================================================================================
  2.            Matlab mode for Alpha, version 2.0b2
  3. ================================================================================
  4.  
  5. This is a set of TCL proc's that allow the shareware Macintosh text editor 
  6. Alpha to act as a front end for MATLAB for Macintosh version 4.2c or 
  7. higher.  Requires Alpha 7.0fc1 or higher.  While you can work with MATLAB 
  8. 4.2c, you should upgrade to MATLAB 5 to avoid the a serious bug in MATLAB 
  9. 4.2c as described below.
  10.  
  11. ================================================================================
  12.            Main Features
  13. ================================================================================
  14.  
  15. • Syntax coloring of keywords
  16. • Automatic line indentation
  17. • Shell like command window for typing in MATLAB commands
  18. • Command history window for easy reissuing of commands
  19. • "Save and Go" for executing m-files
  20. • Execute line or selection sends command(s) to MATLAB
  21. • Get help or open files by selecting or Cmd-double clicking commands
  22. • Debug menu for easy use of MATLAB debugging
  23. • Workspace menu for easy management of the MATLAB workspace
  24. • Can automatically clear old function from workspace when saving file
  25. • Utility to create HTML documentation of MATLAB files
  26.  
  27. ================================================================================
  28.            WARNING
  29. ================================================================================
  30.  
  31. There is a bug in MATLAB 4.2c that will cause MATLAB to crash if the return 
  32. string from a dosc apple event is large.  Since MATLAB mode uses the dosc 
  33. event to talk to MATLAB you should not execute MATLAB scripts from Alpha 
  34. (or Apple Scripts for that matter) that will print large results to the 
  35. screen.  So, for example, don't do this
  36.  
  37. » 1:1000
  38.  
  39. As far as I know there is nothing I can do to prevent this from happening.  
  40.  
  41. This bug has been fixed in MATLAB 5.
  42.  
  43. ================================================================================
  44.            Usage
  45. ================================================================================
  46.  
  47.              Editing matlab files
  48.  
  49. If you open any text file with a .m extension, Alpha will automatically 
  50. recognize it as a MATLAB file and set the current mode to be MATL.  You 
  51. type in your MATLAB code as you normally would, but matlabMode helps you in 
  52. several ways.  It will color certain key words.  You can easily change the 
  53. coloring scheme by setting the mode flags from the 
  54. "Config:Current Mode:Preferences..." menu.
  55.  
  56. As you type you may notice some strange behavior.  If you hit return, the 
  57. next line will be automatically indented for you according to the previous 
  58. lines indentation and the block structure.  You can turn off this feature 
  59. by unselecting "electricReturn" in the mode flags.  In addition if you type 
  60. a semicolon ";", matlabMode will automatically hit return for you.  You can 
  61. turn off this feature by unselecting "electricSemi" in the mode flags.
  62.  
  63. Once you are finished editing the MATLAB file you can select 
  64. "saveAndExecute" from the MATLAB menu to send the file to MATLAB for 
  65. execution.  The results will be shown in the command window within Alpha.  
  66. If you only want to execute part of the file simply select the code you 
  67. want and then choose executeSelection from the MATLAB menu.
  68.  
  69. If there is a matlab file in your code that you wish to edit you can easily 
  70. open several ways.  One is to select the name and the choose 
  71. "openSelection" from the MATLAB menu.  Another way is to Hold down the cmd 
  72. (splat, apple,...) key and double click on the matlab command.  This will 
  73. bring up help on that command.  Hold down both the cmd and control keys and 
  74. double click to edit the m-files.  The mode variable DblClickEdits (settable 
  75. from the Config:Current Mode:Preferences..." menu) will reverse this behavior.
  76.  
  77.  
  78.              Command window
  79.  
  80. This acts similar to the command window in MATLAB.  Simply type in a 
  81. command at the prompt and hit return to have it executed in MATLAB.  Use 
  82. the up and down arrow keys to recall previous commands.  Hit control-u to 
  83. cancel the current line.
  84.  
  85.  
  86.              Command history window
  87.  
  88. This acts similar to the history window in MATLAB: it contains a list of 
  89. all previous commands entered in the command window.  Commands sent from 
  90. m-files are not added.  Use the arrow keys to navigate up or down and hit 
  91. return to reissue the command.
  92.  
  93.  
  94.              Cmd-Double Clicking
  95.  
  96. Hold down the cmd (splat, apple,...) key and double click on a matlab 
  97. command.  This will bring up help on that command.  Hold down both the cmd 
  98. and control keys and double click to edit the m-files depending.  The mode 
  99. variable DblClickEdits (settable from Config:Current Mode:Preferences..." 
  100. or the "Quick Options" menu) will reverse this behavior.
  101.  
  102.              Menu Items
  103.             
  104.                Matlab Menu
  105.  
  106. switchToMatlab       Swap the process to matlab, launching if necessary
  107.  
  108. commandWindow        Open command window
  109.  
  110. commandHistory       Open history window
  111.  
  112. editInMatlab         Close and edit current window in Matlab
  113.  
  114. executeSelection     Execute selection in Matlab; if nothing is selected
  115.                      execute current line
  116.  
  117. saveAndExecute       Save and execute current window
  118.  
  119. openSelection        Open m-files of selection
  120.  
  121.  
  122.                Command Help Menu
  123.  
  124. normalHelp           Presents a dialog box for entering in a command to ask
  125.                      MATLAB for help on.
  126.                             
  127. helpSelection        Get help on selected command in current window
  128.  
  129. searchDocumentation  Search for help on a keyword
  130.  
  131. makeDocumentation    Create HTML documentation for a folder of m-files
  132.  
  133.  
  134.                Workspace Menu
  135.  
  136. rebuildPath          Sends a "path(path)" to MATLAB
  137.  
  138. addToPath            Get the path of current window and add it to MATLAB's path
  139.  
  140. cdToWin              Set current directory to the folder of the current window
  141.  
  142. clearWorkspace       Sends a "clear" to MATLAB
  143.  
  144. clearProcedure       Removes current window's function from the workspace
  145.                      ("clear m-file").
  146.                             
  147. closeAll             Closes all MATLAB figure windows ("close all")                        
  148.  
  149.                Debug Menu
  150.  
  151. stopIfError          Sends "dbstop if error" to MATLAB
  152.  
  153. stopInFile           Sends "dbstop in m-file" to MATLAB
  154.  
  155. stopAtCurrentLine    Sends  "dbstop at current-line in m-file" to MATLAB
  156.  
  157. stepOneLine          Sends "dbstep 1" to MATLAB
  158.  
  159. clearAllBreakpoints  Sends "dbclear all" to MATLAB
  160.  
  161. fileBreakpoints      Sends "dbstatus m-file" to MATLAB
  162.  
  163. openErrorFile        Opens the offending file if an error occurred on the 
  164.                      last command.
  165.  
  166.                Quick Options Menu
  167.             
  168. clearOnSave          If selected sends a "clear functionName" to MATLAB when
  169.                      saving a file.  Useful when the function is a callback and 
  170.                             MATLAB doesn't check if it has changed.
  171.                             
  172. webHelp              All help commands open up the HTML help file if available
  173.  
  174.  
  175.                             
  176.              Non-Menu Key Bindings
  177.  
  178. *All windows*
  179.  
  180. opt-;       Electric semicolon with jump to next stop
  181.  
  182. *Command Window Only*
  183.  
  184. return       Execute current command line in Matlab
  185. up arrow     Recall Previous Command
  186. down arrow   Recall Next Command
  187. control-u    Cancel Line
  188.  
  189. *m-files Window Only*
  190.  
  191. control-return  Execute current line in Matlab
  192.  
  193.  
  194. ================================================================================
  195.            Customization
  196. ================================================================================
  197.  
  198. Here are some things you can set from the "Config:Current Mode:Preferences..." 
  199. menu:
  200.  
  201.    1. Change the name of the command window
  202.    2. Change the name command history window
  203.    3. Toggle the behavior of Cmd-Double Clicking.
  204.    4. Set the color of the different kinds of keywords.
  205.    5. Turn off electric semicolon
  206.    6. Turn off auto-indentation (elecReturn)
  207.     7. Turn off warning that Matlab is busy (queEventsQuietly)
  208.     8. Use web browser to view help files or use normal Matlab help
  209.     9. Automatically send a clear function command to Matlab when saving a file
  210.    
  211. In addition if you want to add menu items you can define a proc in Tcl called
  212. matDummyMenuItem and then simply add items to the matlab menu without 
  213. having to modify matlabMode.tcl.   For example:
  214.  
  215.     addMenuItem $MATLMenu     "(-"
  216.     addMenuItem $MATLMenu  "stephen"
  217.     
  218.     proc matDummyMenuItem {menu item} {
  219.         global MATLMenu
  220.         switch $menu $MATLMenu {
  221.             switch $item {
  222.                 stephen   {insertText "Smart guy"}
  223.             }
  224.         }
  225.     }
  226.  
  227.  
  228. ================================================================================
  229.            Version History
  230. ================================================================================
  231.  
  232.              Changes in Version 2.0b2
  233.  
  234. • Added a queue of events sent to Matlab
  235. • Removed waitForResults as events are now queued
  236.  
  237.              Changes in Version 2.0b1
  238.  
  239. • Made compatible with Alpha 7.0b2
  240. • Removed Electric Alias Support (no longer in Alpha)
  241. • Broke source into many files
  242. • Added makeDocumentation to make HTML docs from m-files
  243.  
  244.              Changes in Version 1.4
  245.  
  246. • Added MATLMarkFile
  247. • Added auto-indentation
  248. • Electric Alias Support
  249. • Electric Semicolon
  250. • Added MATLAB HTML help
  251. • Added option to clear function on save
  252. • Added option to not wait for results
  253.  
  254.              Changes in Version 1.3
  255.  
  256. • Changed mode installation for Alpha 6.2b6 Tcl reorganization.
  257. • Created command history window.
  258. • Renamed more procedures to be more consistent.
  259. • Created mode variables for special window names.
  260. • Added openErrorFile
  261.  
  262.              Changes in Version 1.2
  263.  
  264. • Added control option to DblClickEdits (Requires Alpha 6.04)
  265. • MATLMenu  "•405" now an Alpha resource
  266. • Got rid of MATc mode
  267. • Added matHelp
  268. • Turned on shell flag of command window
  269. • Added matDummyMenuItem proc so users can add items easily to MATLMenu
  270. • Added workspace and debug submenus
  271. • Created matlabMode.tcl so tclIndexes can be used
  272.  
  273.              Changes in Version 1.1
  274.  
  275. • Added cmd-double clicking code by Tom Pollard
  276. • cleaned up prompting in command window
  277. • Removed "redundant" do's from menu
  278. • Open selection now opens associated m-files if selection is a .mex
  279. • Fixed up command line recall
  280.  
  281.              Changes in Version 1.0.1
  282.  
  283. • Fixed a bug in matlabCarriageReturn
  284.  
  285.              Changes in Version 1.0
  286.  
  287. • Added openSelection
  288. • Added command line recall in command window
  289. • Fixed doLine
  290. • Changed key bindings and put some in menu
  291.  
  292.  
  293. ================================================================================
  294.            To Do:
  295. ================================================================================
  296.  
  297. • Insert comment above command line for dbstep in command window
  298. • Add check for error from MATLAB on debugging procs
  299. • Workspace list window
  300. • Help Browser
  301. • "Word completion" in command window
  302. • Loop thru lines in multi-line sends
  303.   
  304. ================================================================================
  305.            Signature
  306. ================================================================================
  307.  
  308. This mode was written by Stephen Merkowitz.  Some code was stolen from 
  309. other TCL files distributed with Alpha (mostly shell.tcl).  Thanks to Tom 
  310. Pollard who gave me cmd-double clicking code along with other fixes.  
  311. Comments, suggestions, and bug reports should be sent to Stephen at
  312. <Stephen.Merkowitz@lnf.infn.it>.
  313.  
  314. You should be able to find the most recent version of MATLAB mode at 
  315. <http://phwave.phys.lsu.edu/~merkowitz/alpha/>
  316.  
  317. If you would like to be notified of new releases of MATLAB mode send mail 
  318. to Stephen at <Stephen.Merkowitz@lnf.infn.it>.
  319.